package cn.springcloud.fix.demo.collection;

import java.util.HashMap;
import java.util.Map;

public class MapSample {

    public static void main(String[] args) {
        Map<String, Object> map = new HashMap<>();
        map.put("张三", "111111");
        map.put("李四", "222222");
        map.put("李四2", "222222");

        //if (map.containsValue("222222")) {
        //    map.put("张三", "222222");
        //}

        for (Map.Entry<String, Object> entry : map.entrySet()) {
            if (entry.getValue().equals("222222")) {
                //map.replace(entry.getKey(), "111111");
                map.put(entry.getKey(), "111111");
            }
        }

        for (Map.Entry<String, Object> entry : map.entrySet()) {
            System.out.println(entry.getKey() + "=" + entry.getValue());
        }

        //if (map.containsKey(cc)) {
        //    String value = map.get(cc).toString();
        //    value = value + ";" + "重复";
        //    map.put(cc, value);
        //} else {
        //    map.put(cc, "121212");
        //}
    }
}
